Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[native_assets_builder] Use package:files FileSystem abstraction #1825

Merged
merged 2 commits into from
Dec 19, 2024

Conversation

mkustermann
Copy link
Member

@mkustermann mkustermann commented Dec 18, 2024

The main motivation for this change is to make package:native_assets_builder cleanly usable in flutter tools. Right now flutter tools operates on a FileSystem and checks whether .dart_tool/package_config.json exists using that FileSystem but then reads the file with this packagag's code which uses dart:io.

This inconsistency causes issues in flutter tools. Using package:file should solve this and would also
allow injecting mocks. To be fully mockable the implementation would also need to make process invocations
mockable via package:process. That's a future task.

See also #90

@coveralls
Copy link

coveralls commented Dec 18, 2024

Coverage Status

coverage: 87.957% (-0.001%) from 87.958%
when pulling 1ee0111 on package-file
into acc5534 on main.

@mkustermann mkustermann requested a review from dcharkes December 18, 2024 14:04
Copy link
Collaborator

@dcharkes dcharkes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please mention #90 in the PR description.

Unfortunately, almost of our tests also require process runs, so we can't change any of our tests to use the virtual file system.

Anyway, this is a step in that direction, so LGTM!

There's in more import in pkgs/native_assets_builder/lib/src/utils/run_process.dart which can get a show xxx to ensure we don't see any of the dart:io File/Directory types anywhere in lib/src.

@mkustermann
Copy link
Member Author

Please mention #90 in the PR description.

Done.

Unfortunately, almost of our tests also require process runs, so we can't change any of our tests to use the virtual file system.
Anyway, this is a step in that direction, so LGTM!

One step at a time.

There's in more import in pkgs/native_assets_builder/lib/src/utils/run_process.dart which can get a show xxx to ensure we don't see any of the dart:io File/Directory types anywhere in lib/src.>

Done.

@mkustermann mkustermann merged commit 9596c1f into main Dec 19, 2024
20 of 22 checks passed
@mkustermann mkustermann deleted the package-file branch December 19, 2024 11:19
@dcharkes
Copy link
Collaborator

Thanks @mkustermann !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants